package com.definity.toolkit.ui.widget;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;

import javax.swing.JMenu;

import com.definity.toolkit.ui.Body;

public class Menu extends JMenu implements Widget<Menu> {

	private static final long serialVersionUID = 8914216568680637014L;

	public Menu(String text) {
		super(text);
	}
	
	@Override
	public String id() {
		return getName();
	}

	@Override
	public Menu id(String id) {
		setName(id);
		return this;
	}

	@Override
	public Menu properties(Body<Menu> body) {
		body.content(this);
		return this;
	}

	@Override
	public Menu size(int width, int height) {
		setPreferredSize(new Dimension(width, height));
		return this;
	}
	
	public String text() {
		return getText();
	}
	
	public Menu text(String text) {
		setText(text);
		return this;
	}

	public Menu add(Menu menu) {
		add(menu);
		return this;
	}

	public Menu add(MenuItem menuItem) {
		super.add(menuItem);
		return this;
	}

	public Menu separator() {
		super.addSeparator();
		return this;
	}

	@Override
	public Color background() {
		return getBackground();
	}

	@Override
	public Menu background(Color background) {
		setBackground(background);
		return this;
	}

	@Override
	public Color foreground() {
		return getForeground();
	}

	@Override
	public Menu foreground(Color foreground) {
		setForeground(foreground);
		return this;
	}

	@Override
	public Font font() {
		return getFont();
	}

	@Override
	public Menu font(Font font) {
		setFont(font);
		return this;
	}
	
}
